﻿using Microsoft.AspNetCore.SignalR;

namespace WebAPITest
{
    public class MyHub : Hub
    {
        public Task SendPublicMessage(string msg)
        {
            string connId = this.Context.ConnectionId;
            return Clients.All.SendAsync("ReceiveMessage", $"收到消息：{connId}:{msg}");
        }

        public async Task SendMessage(string user, string message)
        {
            await Clients.All.SendAsync("ReceiveMessage", user, message);
        }
    }
}
